package com.wjj.sixinone.controller.admin;

import com.wjj.sixinone.common.enums.ApiTypeConst;
import com.wjj.sixinone.common.pojo.vo.IpVO;
import com.wjj.sixinone.common.util.Result;
import com.wjj.sixinone.service.IpService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping(ApiTypeConst.API_ADMIN+"/ip")
public class IpController {
    @Autowired
    private IpService ipService;

    @PostMapping("/banIp")
    public Result BanIp(@RequestBody Map<String,String> map ) {


        return ipService.banIp(map);

    }
    @GetMapping("/getAllBannedIps")
    public Result getAllBannedIps(IpVO ipVO) {
        return ipService.getAllBannedIps(ipVO);
    }
    @PostMapping("/deleteByIp")
    public Result deleteByIp(@RequestBody Map<String,String> map) {
        return ipService.deletByIp(map);
    }
    @GetMapping("/uploadExcel")
    public void uploadExcel(HttpServletResponse response) {
         ipService.uploadExcel(response);
    }
}
